<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <button class="box">
        点击

    </button>
    <script>
        const btn = document.querySelector('.box')
        btn.addEventListener('click', throttle(handle, 1000))

        function handle() {
            console.log(111, this)//this指向btn
        }
        function throttle(fn, delay) {
            let oldTime = 0//页面渲染时就执行了，也可以写成Date.now()
            return function (...args) {
                let curTime = Date.now()
                if (curTime - oldTime > delay) {
                    fn.apply(this, args)
                    oldTime = curTime
                }
            }
        }
    </script>
</body>

</html>